package com.hy.admin.dao;

import com.hy.admin.entity.MemberEntity;
import com.hy.admin.entity.TeacherEntity;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * Created by shitou on 17/12/27.
 */
@Repository
public interface MemberDao {

    MemberEntity selectById(@Param("id") long id);

    List<MemberEntity> selectByMobile(@Param("mobile") String mobile);

    int init(MemberEntity memberEntity);

    /**
     * 初始化游客账户
     * @param memberEntity
     * @return
     */
    int initNew(MemberEntity memberEntity);

    int updateAccountId(MemberEntity memberEntity);

    int update(MemberEntity memberEntity);

    int bindMobile(MemberEntity memberEntity);

    int updateCertPic(MemberEntity memberEntity);

    /**
     * 查询除id以外的用户
     * @param id
     * @return
     */
    List<Long> selectIdList(Long id);

    /**
     * 查询除id以外的用户token
     * @param id
     * @return
     */
    List<String> selectDeviceToken(Long id);

    /**
     * 查询除id以外的用户deviceId
     * @param id
     * @return
     */
    List<String> selectAliDeviceId(Long id);

    MemberEntity selectDeviceIdentify(String deviceIdentify);

    int selectCountByType(Integer memberType);

    List<MemberEntity> selectByType(Integer memberType);

    /**
     * 查询所有教师
     * @param relatedType
     * @param memberType
     * @return
     */
    List<TeacherEntity> selectTeacher(@Param("relatedType") Integer relatedType,
                                      @Param("memberType") Integer memberType,
                                      @Param("keyword") String keyword);

    /**
     * 名师推荐
     * @param relatedType
     * @param memberType
     * @return
     */
    List<TeacherEntity> selectTeacherRecommend(@Param("relatedType") Integer relatedType,
                                               @Param("memberType") Integer memberType);
    int updateAuditStatus(@Param("id")Long id, @Param("auditStatus") Integer auditStatus);

    int updateDeviceToken(@Param("id")Long id, @Param("deviceToken") String deviceToken);

    int updateAliDeviceId(@Param("id")Long id, @Param("aliDeviceId") String aliDeviceId);
}
